package com.example.demo.controller;

import com.example.demo.config.Result;
import com.example.demo.entity.user.InsertUser;
import com.example.demo.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Tag(name = "User API", description = "用户管理")
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @Operation(summary = "查询所有用户信息", tags = "User API")
    @GetMapping(value = "/findAll")
    public Result findAll() {
        try {
            return Result.success(userService.findAll());
        } catch (Exception e) {
            return Result.error(e.getMessage());
        }

    }



}
